package com.it00zyq.common.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

/**
 * 转换Page
 */
@Data
public class PageVO {

    private Long pageNum;

    private Long pageSize;

    private Long count;

    private Long page;

    private Object content;

    public static PageVO convert(IPage page) {
        PageVO pageVO = new PageVO();
        pageVO.pageNum = page.getCurrent();
        pageVO.pageSize = page.getSize();
        pageVO.count = page.getTotal();
        pageVO.page = page.getPages();
        pageVO.content = page.getRecords();
        return pageVO;
    }

    public static PageVO convert(IPage page, Object content) {
        PageVO pageVO = new PageVO();
        pageVO.pageNum = page.getCurrent();
        pageVO.pageSize = page.getSize();
        pageVO.count = page.getTotal();
        pageVO.page = page.getPages();
        pageVO.content = content;
        return pageVO;
    }
}
